package com.example.tvmatchddemo.base;


import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import java.util.List;

/**
 * Created by dasu on 2017/4/20.
 * <p>
 * ViewPager的适配器，用于根据List的tab名来生成对应的Fragment，每个Fragment必须传入其type的参数
 */

public class PagerFragmentAdapter extends FragmentStateAdapter {

    private List<Fragment> mFragmentList;
    private List<String> mTabNameList;
    private Fragment mCurFragment;

    public PagerFragmentAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    public PagerFragmentAdapter(@NonNull Fragment fragment) {
        super(fragment);
    }

    public PagerFragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
        super(fragmentManager, lifecycle);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return null;
    }

    @Override
    public int getItemCount() {
        return 0;
    }
//
//    public PagerFragmentAdapter(FragmentManager fm, List<Fragment> mFragmentList, List<String> mTabNameList) {
//        super(fm);
//        this.mFragmentList = mFragmentList;
//        this.mTabNameList = mTabNameList;
//    }
//
//    @Override
//    public Fragment getItem(int position) {
//        return mFragmentList.get(position);
//    }
//
//    @Override
//    public int getCount() {
//        return mFragmentList != null ? mFragmentList.size() : 0;
//    }
//
//    @Override
//    public CharSequence getPageTitle(int position) {
//        return mTabNameList.get(position);
//    }
//
//    @Override
//    public void setPrimaryItem(ViewGroup container, int position, Object object) {
//        super.setPrimaryItem(container, position, object);
//        mCurFragment = (Fragment) object;
//    }
//
//   public Fragment getCurrentFragment() {
//        return mCurFragment;
//    }
}
